class Solution {
public:
    int get_con(int s,int n){

        long long start=s;
        long long en=s+1;
        int con=0;
        while(start<=n){

            con+=min((long long)n+1,en)-start;
            start*=10;
            en*=10;
        }
        return con;
    }
    int findKthNumber(int n, int k) {
        long long cur=1;
        while(k>1){

            int con=get_con(cur,n);
            if(con<k){

                k-=con;
                cur++;
            }
            else{

                k--;
                cur*=10;
            }
        }
        return cur;
    }
};
